﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace PHMEE.Migrations
{
    /// <inheritdoc />
    public partial class merge1_0AddCBMDataSyncLog : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "EeTimeSeriesDataLogs",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Ts = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    SyncDataType = table.Column<int>(type: "int", nullable: false),
                    OperationType = table.Column<int>(type: "int", nullable: false),
                    OperationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EeTimeSeriesDataLogs", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "EeTimeSeriesTombstones",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    Ts = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    VesselId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    SyncDataType = table.Column<int>(type: "int", nullable: false),
                    DeletedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EeTimeSeriesTombstones", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_EeTimeSeriesTombstones_VesselId_Ts_SyncDataType",
                table: "EeTimeSeriesTombstones",
                columns: new[] { "VesselId", "Ts", "SyncDataType" });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "EeTimeSeriesDataLogs");

            migrationBuilder.DropTable(
                name: "EeTimeSeriesTombstones");
        }
    }
}
